<!--
  @author tanlei
  @since 2021/07/06 14:52
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<div class="layui-card-body" th:fragment="new_order_company_send_order">
  <form method="POST" action="" class="layui-form" lay-filter="zmn-form" id="zmn-form">
    <input type="hidden" name="weightId" th:value="${obj.weightId}"/>
    <input type="hidden" name="bizType" th:value="${obj.bizType}"/>

    <div class="layui-row">
      <div class="layui-col-sm10">
        <div class="layui-form-item">
          <label class="layui-form-label layui-form-required">服务平台</label>
          <div class="layui-input-inline">
            <select name="plat" id="plat" lay-filter="plat" class="layui-disabled" disabled>
              <option value="" th:selected="${0 == obj.plat}">全部</option>
              <option th:value="${item.key}"
                      th:text="${item.value}"
                      th:selected="${item.key == obj.plat}"
                      th:each="item:${platList}">平台
              </option>
            </select>
          </div>
        </div>
      </div>
    </div>

    <div class="layui-row">
      <div class="layui-col-sm10">
        <div class="layui-form-item">
          <label class="layui-form-label layui-form-required">服务商</label>
          <div class="layui-input-inline">
            <select id="companyId" lay-filter="companyId" name="companyId" th:disabled="${obj.weightId}"
                    lay-verify="required" lay-search>
              <option value="" th:selected="${0 == obj.companyId}">全部</option>
              <option th:value="${item.value}"
                      th:text="${item.text}"
                      th:selected="${item.value == obj.companyId}"
                      th:each="item:${companyList}">平台
              </option>
            </select>
          </div>
        </div>
      </div>
    </div>

    <div class="layui-row">
      <div class="layui-col-sm10">
        <div class="layui-form-item">
          <label class="layui-form-label layui-form-required">城市</label>
          <div class="layui-input-inline">
            <select name="cityId" id="cityId" lay-filter="cityId"
                    lay-verify="required"
                    th:disabled="${obj.weightId}" lay-search>
              <option value="">全部</option>
              <option th:value="${item.value}"
                      th:text="${item.text}"
                      th:selected="${item.value == obj.cityId}"
                      th:each="item:${cityList}">城市
            </select>
          </div>
          <div class="layui-form-mid layui-word-aux">请先选择：服务商，再选：城市</div>
        </div>
      </div>
    </div>

    <div class="layui-row">
      <div class="layui-col-sm10">
        <div class="layui-form-item">
          <label class="layui-form-label layui-form-required">新单简单派单</label>
          <div class="layui-input-inline" style="width: 60px">
            <input type="checkbox" id="newSimpleStatus" name="newSimpleStatus"
                   th:checked="${obj.newSimpleStatus == 2}"
                   lay-filter="newSimpleStatus"
                   lay-text="ON|OFF" value="2" lay-skin="switch"/>
          </div>
          <div class="layui-form-mid layui-word-aux">针对：新单&普通派单，打开状态，即：只会判断基础条件</div>
        </div>
      </div>
    </div>

    <div class="layui-row">
      <div class="layui-col-sm10">
        <div class="layui-form-item">
          <label class="layui-form-label layui-form-required">新单自动派单</label>
          <div class="layui-input-block">
            <input type="radio" name="autoStatusNew" value="2" title="推荐自动派"
                   lay-filter="autoStatusNew"
                   th:checked="${obj.autoStatusNew == 2 || obj.autoStatusNew == null}">
            <input type="radio" name="autoStatusNew" value="3" title="指定工程师自动派"
                   lay-filter="autoStatusNew"
                   th:checked="${obj.autoStatusNew == 3}" th:disabled="${obj.newSimpleStatus == 1}">
            <input type="radio" name="autoStatusNew" value="4" title="公平自动派单"
                   lay-filter="autoStatusNew"
                   th:checked="${obj.autoStatusNew == 4}">
            <input type="radio" name="autoStatusNew" value="1" title="关闭自动派"
                   lay-filter="autoStatusNew"
                   th:checked="${obj.autoStatusNew == 1}" th:disabled="${obj.newSimpleStatus == 1}">
          </div>
        </div>
      </div>
    </div>

<!--    <div class="layui-row">-->
<!--      <div class="layui-col-sm10">-->
<!--        <div class="layui-form-item">-->
<!--          <label class="layui-form-label layui-form-required">返修自动派单</label>-->

<!--          <div class="layui-input-block">-->
<!--            <input type="radio" name="autoStatusRework" value="2" title="源工程师自动派"-->
<!--                   th:checked="${obj.autoStatusRework == 2 || obj.autoStatusRework == null}">-->
<!--            <input type="radio" name="autoStatusRework" value="1" title="关闭自动派"-->
<!--                   th:checked="${obj.autoStatusRework == 1}">-->
<!--          </div>-->

<!--        </div>-->
<!--      </div>-->
<!--    </div>-->

    <div class="layui-row">
      <div class="layui-col-sm10">
        <div class="layui-form-item">
          <label class="layui-form-label">自动派单时间</label>
          <div class="layui-input-inline">
            <input type="text"
                   name="autoTimeStr"
                   id="autoTimeStr"
                   class="layui-input"/>
          </div>
          <div class="layui-form-mid layui-word-aux">在对应时间段内，自动派单</div>
        </div>
      </div>
    </div>

<!--    <div class="layui-row">-->
<!--      <div class="layui-col-sm10">-->
<!--        <div class="layui-form-item">-->
<!--          <label class="layui-form-label layui-form-required">最大返修单量</label>-->
<!--          <div class="layui-input-inline">-->
<!--            <input type="text" name="reworkLimit"-->
<!--                   th:value="${obj.reworkLimit}"-->
<!--                   lay-verify="required|reworkLimit"-->
<!--                   lay-verType="tips"-->
<!--                   placeholder="请输入0或正整数"-->
<!--                   autocomplete="off"-->
<!--                   class="layui-input" maxlength="6"/>-->
<!--          </div>-->
<!--          <div class="layui-form-mid layui-word-aux">不含：拉修待件、统一结算、开发票、失败申请</div>-->
<!--        </div>-->
<!--      </div>-->
<!--    </div>-->

    <div class="layui-row">
      <div class="layui-col-md10">
        <div class="layui-form-item">
          <label class="layui-form-label layui-form-required">新单派单权重</label>
          <div class="layui-form-item" th:each="relation:${obj.distributeWeightRelationList}">
            <label class="layui-form-label" th:if="${relation.weightType == 1}" style="margin-left: 3%;">直营工程师：</label>
            <label class="layui-form-label" th:if="${relation.weightType == 2}" style="margin-left: 4%;">非直营工程师：</label>
            <div class="layui-form-item">
              <div class="layui-input-inline" style="width: 600px; margin-left: 5%;">
                <table class="layui-hide" th:id="zmn-table-+${relation.weightType}" th:lay-filter="zmn-table-+${relation.weightType}">
                  <thead>
                  <tr>
                    <th lay-data="{field:'relationId',hide: true}">
                      派单关联id
                    </th>
                    <th lay-data="{field:'weightType',hide: true}">
                      权重类型
                    </th>
                    <th lay-data="{field:'distributeApplication',hide: true}">
                      派单应用
                    </th>
                    <th lay-data="{field:'distributeConfigId',hide: true}">
                      派单配置id
                    </th>
                    <th lay-data="{field:'distanceWeight', edit:true, unresize:true, align:'center'}">
                      距离
                    </th>
                    <th lay-data="{field:'handlerWeight', edit:true, unresize:true, align:'center'}">
                      手头单占比
                    </th>
                    <th lay-data="{field:'distributeNewCount', edit:true, unresize:true, align:'center'}">
                      新单派单量
                    </th>
                    <th lay-data="{field:'starLevelScoreWeight', width:110, edit:true, unresize:true, align:'center'}">
                      星级分
                    </th>
                    <th lay-data="{field:'serveScore', edit:true, unresize:true, align:'center'}">
                      服务分
                    </th>
                    <th lay-data="{field:'datumOrderHourRatio', edit:true, unresize:true, align:'center'}">
                      单时比
                    </th>
                  </tr>
                  </thead>
                  <tbody>
                  <tr>
                    <td th:text="${relation.relationId}"></td>
                    <td th:text="${relation.weightType}"></td>
                    <td th:text="${relation.distributeApplication}"></td>
                    <td th:text="${relation.distributeConfigId}"></td>
                    <td th:text="${relation.distanceWeight}"></td>
                    <td th:text="${relation.handlerWeight}"></td>
                    <td th:text="${relation.distributeNewCount}"></td>
                    <td th:text="${relation.starLevelScoreWeight}"></td>
                    <td th:text="${relation.serveScore}"></td>
                    <td th:text="${relation.datumOrderHourRatio}"></td>
                  </tr>
                  </tbody>
                </table>
                <div class="layui-form-mid layui-word-aux">仅针对：新单推荐自动派，权重之和为：100；自动派单设置为：推荐自动派时生效；</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <zmn th:if="${obj.weightId>0}">
      <div class="layui-card-header layui-margin-b"><b>其他信息</b></div>

      <div class="layui-form-item layui-form-item-sm">
        <label class="layui-form-label">修改人/时间：</label>
        <div class="layui-input-block">
          <div class="layui-form-mid layui-word-aux"
               th:text="${obj.updater} + '&nbsp;/&nbsp;' + ${#dates.format(obj.updateTime, 'yyyy-MM-dd HH:mm:ss')}">
            修改人/时间
          </div>
        </div>
      </div>
      <div class="layui-form-item layui-form-item-sm">
        <label class="layui-form-label">创建人/时间：</label>
        <div class="layui-input-block">
          <div class="layui-form-mid layui-word-aux"
               th:text="${obj.creater} + '&nbsp;/&nbsp;' + ${#dates.format(obj.createTime, 'yyyy-MM-dd HH:mm:ss')}">
            创建人/时间
          </div>
        </div>
      </div>
    </zmn>

    <div class="layui-row">
      <div class="layui-col-sm10">
        <div class="layui-form-item submit">
          <div class="layui-input-block">
            <button class="layui-btn" th:if="${#authPermit.checkPermit('/orderconfig/distribute/company/modify.action')}"
                    lay-submit="" lay-filter="zmn-form-submit">保存</button>
            <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
          </div>
        </div>
      </div>
    </div>
  </form>
</div>



